<template>
  <div>
    <template v-for="i in applies">
      <div class="item">
        <el-row type="flex" justify="space-between">
          <el-col :span="4">用户 :{{ i.username }}</el-col>
          <el-col :span="4">
            <el-button v-if="i.pdfurl" type="primary" @click="preview(i.pdfurl)">查看附件简历</el-button>
          </el-col>
        </el-row>
        <el-row type="flex" justify="space-between">
          <el-col :span="4">职位 :{{ i.jobname }}</el-col>
          <el-col :span="4">
            <el-dropdown @command="handleCommand">
                    <span class="el-dropdown-link">
                   审核<i class="el-icon-arrow-down el-icon--right"></i>
                   </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item :command="{id:i.id,state:-1}">拒绝</el-dropdown-item>
                <el-dropdown-item :command="{id:i.id,state:1}">简历通过</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-col>
        </el-row>
      </div>
    </template>
    <el-dialog
        :visible.sync="dialogVis"
    >
      <pdf :src="biographicalNotesUrl"/>
    </el-dialog>
  </div>

</template>

<script>
import {requests} from "@/utils/request";
import pdf from "vue-pdf";
import jobs from "@/utils/api/jobs";
export default {
  name: "apply",
  components: {
    pdf
  },
  data() {
    return {
      dialogVis: false,
      biographicalNotesUrl: '',
      applies: []
    }
  },
  mounted() {
    this.getdata()
  }
  ,
  methods: {
    getdata() {
      requests.get('job/getapply').then(res => {
        this.applies = res.data.data
      })
    },
    preview(url) {
      this.biographicalNotesUrl = url;
      this.dialogVis = true
    },
    handleCommand(c){
      jobs.check(c.state,c.id)
    }
  }
}
</script>

<style scoped>
.item {
  background-color: white;
}
</style>